package com.zbkj.admin.controller.platform.assistant.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.zbkj.common.model.assistant.AssistantConversation;
import com.zbkj.common.model.assistant.AssistantMessage;
import com.zbkj.common.model.assistant.AssistantSetting;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.service.assistant.model.request.AssistantMessageAdminSearchRequest;
import com.zbkj.service.assistant.model.request.AssistantMessageAdminSendRequest;
import com.zbkj.service.assistant.model.vo.AssistantMessageVO;

import java.util.List;


/**
* @author keNan
* @description AssistantMessageService 接口
* @date 2025-06-11
*/
public interface AssistantMessageService extends IService<AssistantMessage> {
    /**
     * 获取指定会话的全部聊天消息
     * @param conversationId 会话id
     * @return
     */
    List<AssistantMessageVO> findByConversationId(Integer conversationId);

    /**
     * 获取指定会话的消息列表
     * @param setting 设置
     * @param conversation 会话
     * @return
     */
    Boolean checkIsTimeout(AssistantSetting setting, AssistantConversation conversation);

    /**
     * 获取指定会话的最新消息
     * @param conversationId 会话id
     * @return
     */
    AssistantMessageVO getLastMessage(Integer conversationId);

    /**
     * 获取指定用户发送的消息的未读数量
     * @param userId 指定用户
     * @return
     */
    Integer getUnreadCount(Integer userId);

    /**
     * 客服发送消息给用户
     * @param request
     * @param adminId
     * @return
     */
    AssistantMessageVO sendByAdmin(AssistantMessageAdminSendRequest request, Integer adminId);

    /**
     * 客服获取与用户的消息列表
     * @param request
     * @param pageParamRequest
     * @return
     */
    PageInfo<AssistantMessageVO> getAdminMessageList(AssistantMessageAdminSearchRequest request, PageParamRequest pageParamRequest);

    /**
     * 系统发送消息给用户
     * @param conversation 会话
     * @param contentType 消息类型
     * @param content 消息内容
     * @param isPushToUser 是否通过netty推送给用户
     */
    void sendBySystem(AssistantConversation conversation, Integer contentType, String content, Boolean isPushToUser);
    void sendBySystem(AssistantConversation conversation, Integer contentType, String content, Boolean isPushToUser, Integer serviceContentType);

    /**
     * 读消息
     * @param messageId 消息id
     */
    void read(Integer messageId);
}